package com.um.jdy.platform.alarm.manager;

import com.um.jdy.common.alarm.entity.dto.AlarmNoticeDTO;
import com.um.jdy.common.alarm.entity.po.AlarmNotice;
import com.um.jdy.common.alarm.entity.vo.AlarmNoticeVO;
import com.um.jdy.common.alarm.service.AlarmNoticeService;
import com.um.jdy.platform.alarm.entity.dto.AlarmNoticePageDTO;
import com.um.jdy.platform.alarm.entity.vo.AlarmNoticetemVO;
import com.um.springboot.starter.entity.Page;
import com.um.springboot.starter.orm.entity.Response;
import com.um.springboot.starter.orm.manager.BasePlusManager;
import com.um.springboot.starter.orm.params.ListDTO;
import com.um.springboot.starter.orm.params.PageParams;
import org.springframework.stereotype.Component;

/**
 * 管理类：告警通知
 */
@Component
public class AlarmNoticeManager extends BasePlusManager<AlarmNoticeService, AlarmNotice, AlarmNoticeDTO, AlarmNoticeVO, AlarmNoticePageDTO, ListDTO> {

    /**
     * 分页查询告警通知
     *
     * @param params
     * @return
     */
    public Response<Page<AlarmNoticetemVO>> getRecordPage(PageParams params){
        Page<AlarmNoticetemVO> page = new Page<>();
        page.setPageNo(params.getPageNo());
        page.setPageSize(params.getPageSize());

        params.getCondition().put("n.com_id",getComId());

        page = service.getCMSViewModelPageBySqlName(page, "get_alarm_notice_page","get_alarm_notice_count", AlarmNoticetemVO.class,params.getProperties(), params.getValues(),params.getRangeEntitys(),params.getOrderNames(),params.getSortOns());

        return Response.success(page);
    }
}
